package com.mlk.engSystem.controller;

import com.mlk.core.component.page.Pager;
import com.mlk.core.util.ServerResponse;
import com.mlk.engSystem.po.EngSysBanner;
import com.mlk.engSystem.service.EngSystemBannerService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

/**
 * 系统轮播图展示
 * @author xulu
 */
@Controller
@RequestMapping("/eng/system/banner")
public class EngSystemBannerController {

    @Resource
    private EngSystemBannerService engSystemBannerService;

    /**
     * 回到首页
     * @return
     */
    @RequestMapping("index")
    public String index(){
        return "engSystem/banner";
    }

    /**
     * 数据展示列表
     * @return
     */
    @RequestMapping("listPage")
    @ResponseBody
    public Pager listPage(){
        return this.engSystemBannerService.listPage();
    }

    /**
     * 新增
     * @param banner
     * @param file
     * @return
     */
    @RequestMapping("add")
    @ResponseBody
    public ServerResponse add(EngSysBanner banner, MultipartFile file){
        return this.engSystemBannerService.add(banner,file);
    }

    /**
     * 删除 更新 激活
     * @param banner
     * @return
     */
    @ResponseBody
    @RequestMapping("update")
    public ServerResponse update(EngSysBanner banner){
        return this.engSystemBannerService.update(banner);
    }
}
